package com.example.Lambda;

public class StringHandlerDemo {
    public static void main(String[] args) {
        useStringHandler(new StringHandler() {
            @Override
            public void printMessage(String message) {
                System.out.println("匿名内部类中的" + message);
            }
        });

        //Lambda实现
        useStringHandler((String message) -> {System.out.println("Lambda中的" + message);});
    }

    public static void useStringHandler(StringHandler stringHandler) {
        stringHandler.printMessage("xupt");
    }
}

interface StringHandler {
    void printMessage(String message);
}